<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of tt_mm</title>
  <meta name="keywords" content="tt_mm">
  <meta name="description" content="Matrix-by-matrix product in TT1.0 format">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html v1.5 &copy; 2003-2005 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../../index.html">Home</a> &gt;  <a href="#">tt2</a> &gt; <a href="index.html">core</a> &gt; tt_mm.m</div>

<!--<table width="100%"><tr><td align="left"><a href="../../index.html"><img alt="<" border="0" src="../../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="index.html">Index for tt2/core&nbsp;<img alt=">" border="0" src="../../right.png"></a></td></tr></table>-->

<h1>tt_mm
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>Matrix-by-matrix product in TT1.0 format</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>function [res]=tt_mm(mat1,mat2) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="fragment"><pre class="comment">Matrix-by-matrix product in TT1.0 format
   [RES]=TT_MM(MAT1,MAT2) Matrix MAT1 by matrix MAT2 product in the 
   TT-format. Please avoid its usage: it will be removed in
   future releases. Use * operator from the object-oriented version.


 TT-Toolbox 2.2, 2009-2011

This is TT Toolbox, written by Ivan Oseledets, Olga Lebedeva
Institute of Numerical Mathematics, Moscow, Russia
webpage: http://spring.inm.ras.ru/osel

For all questions, bugs and suggestions please mail
ivan.oseledets@gmail.com
---------------------------</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../../matlabicon.gif)">
<li><a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>	Mode sizes of the TT-matrix</li><li><a href="../../tt2/@tt_tensor/reshape.html" class="code" title="function [tt2]=reshape(tt1,sz,eps, rl, rr)">reshape</a>	Reshape of the TT-tensor</li><li><a href="../../tt2/@tt_tensor/size.html" class="code" title="function [sz] = size(tt,dim)">size</a>	Mode sizes of the TT-tensor</li></ul>
This function is called by:
<ul style="list-style-image:url(../../matlabicon.gif)">
<li><a href="../../tt2/exp/tt_minres_selfprec.html" class="code" title="function [X]=tt_minres_selfprec(A, tol, eps, maxit, prec_type)">tt_minres_selfprec</a>	Computation of the approximate TT-matrix inverse using self-prec method</li></ul>
<!-- crossreference -->



<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function [res]=tt_mm(mat1,mat2)</a>
0002 <span class="comment">%Matrix-by-matrix product in TT1.0 format</span>
0003 <span class="comment">%   [RES]=TT_MM(MAT1,MAT2) Matrix MAT1 by matrix MAT2 product in the</span>
0004 <span class="comment">%   TT-format. Please avoid its usage: it will be removed in</span>
0005 <span class="comment">%   future releases. Use * operator from the object-oriented version.</span>
0006 <span class="comment">%</span>
0007 <span class="comment">%</span>
0008 <span class="comment">% TT-Toolbox 2.2, 2009-2011</span>
0009 <span class="comment">%</span>
0010 <span class="comment">%This is TT Toolbox, written by Ivan Oseledets, Olga Lebedeva</span>
0011 <span class="comment">%Institute of Numerical Mathematics, Moscow, Russia</span>
0012 <span class="comment">%webpage: http://spring.inm.ras.ru/osel</span>
0013 <span class="comment">%</span>
0014 <span class="comment">%For all questions, bugs and suggestions please mail</span>
0015 <span class="comment">%ivan.oseledets@gmail.com</span>
0016 <span class="comment">%---------------------------</span>
0017 d=<a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(mat1,1);
0018 res=cell(d,1);
0019 k=1;
0020 <span class="keyword">for</span> s=1:2
0021 n1=<a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(mat1{k},1);
0022 m1=<a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(mat1{k},2);
0023 rm=<a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(mat1{k},3);
0024 n2=<a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(mat2{k},1);
0025 m2=<a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(mat2{k},2);
0026 rv=<a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(mat2{k},3);
0027 <span class="comment">%mat1{1} is (n1 x m1 x rm , mat2{1} is n2xm2xrm, result is n1xm2xrv1*rv)</span>
0028 <span class="comment">%res{1}=reshape(permute(mat1{1},[1,3,2],[n1*rm1]),m1)*reshape(mat2{1},[n2,m2*rv2]);</span>
0029 res{k}=<a href="../../tt2/@tt_tensor/reshape.html" class="code" title="function [tt2]=reshape(tt1,sz,eps, rl, rr)">reshape</a>(permute(mat1{k},[1,3,2]),[n1*rm,m1])*<a href="../../tt2/@tt_tensor/reshape.html" class="code" title="function [tt2]=reshape(tt1,sz,eps, rl, rr)">reshape</a>(mat2{k},[n2,m2*rv]);
0030 <span class="comment">%res{1} is n1 x rm x m2 x rv</span>
0031 res{k}=<a href="../../tt2/@tt_tensor/reshape.html" class="code" title="function [tt2]=reshape(tt1,sz,eps, rl, rr)">reshape</a>(res{k},[n1,rm,m2,rv]);
0032 res{k}=permute(res{k},[1,3,2,4]);
0033 res{k}=<a href="../../tt2/@tt_tensor/reshape.html" class="code" title="function [tt2]=reshape(tt1,sz,eps, rl, rr)">reshape</a>(res{k},[n1,m2,rm*rv]);
0034 <span class="keyword">if</span> ( k == 1 ) 
0035  k=d;
0036 <span class="keyword">end</span>
0037 <span class="keyword">end</span>
0038 <span class="keyword">for</span> i=2:d-1
0039   n1=<a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(mat1{i},1);
0040   m1=<a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(mat1{i},2);
0041   rm1=<a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(mat1{i},3);
0042   rm2=<a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(mat1{i},4);
0043   n2=<a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(mat2{i},1);
0044   m2=<a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(mat2{i},2);
0045   rv1=<a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(mat2{i},3);
0046   rv2=<a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(mat2{i},4);
0047   <span class="comment">%mat1{i} is n1 x m1 x rm1 x rm2</span>
0048   <span class="comment">%mat2{i} is n2 x m2 x rv1 x rv2</span>
0049   <span class="comment">%n1 x rm1 x rm2 x m1 * n2 x m2 x rv1 x rv2</span>
0050   <span class="comment">%n1 x rm1 x rm2 x m2 x rv1 x rv2</span>
0051   <span class="comment">%Need: n1 x m2 x rm1 x rv1 x rm2 x rv2</span>
0052   <span class="comment">%Permut: 1 4 2 5 3 6</span>
0053   res{i}=<a href="../../tt2/@tt_tensor/reshape.html" class="code" title="function [tt2]=reshape(tt1,sz,eps, rl, rr)">reshape</a>(permute(mat1{i},[1,3,4,2]),[n1*rm1*rm2,m1])*<a href="../../tt2/@tt_tensor/reshape.html" class="code" title="function [tt2]=reshape(tt1,sz,eps, rl, rr)">reshape</a>(mat2{i},[n2,m2*rv1*rv2]);
0054   res{i}=<a href="../../tt2/@tt_tensor/reshape.html" class="code" title="function [tt2]=reshape(tt1,sz,eps, rl, rr)">reshape</a>(res{i},[n1,rm1,rm2,m2,rv1,rv2]);
0055   res{i}=permute(res{i},[1,4,2,5,3,6]);
0056   res{i}=<a href="../../tt2/@tt_tensor/reshape.html" class="code" title="function [tt2]=reshape(tt1,sz,eps, rl, rr)">reshape</a>(res{i},[n1,m2,rm1*rv1,rm2*rv2]);
0057 <span class="keyword">end</span> 
0058 <span class="keyword">return</span>
0059 <span class="keyword">end</span></pre></div>
<hr><address>Generated on Wed 08-Feb-2012 18:20:24 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> &copy; 2005</address>
</body>
</html>